﻿namespace CohesionAndCoupling
{
    using System;

    internal static class TwoDimensionalOperations
    {
        internal static double CalculateDistance(double x1, double y1, double x2, double y2)
        {
            double distance =
                Math.Sqrt(
                ((x2 - x1) * (x2 - x1)) +
                ((y2 - y1) * (y2 - y1)));

            return distance;
        }

        internal static double CalculateDistanceToOrigin(double x, double y)
        {
            double distance = CalculateDistance(0, 0, x, y); // I could use the formula instead of the method for loose coupling but because the methods are with the same accessors in the same class I guess it is better idea to do not repeat code.

            return distance;
        }
    }
}